import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.extend(relativeTime)
dayjs.locale('zh-cn')

function dateFromNow(date) {
  return dayjs(date).fromNow()
}

function dateToStr(date) {
  return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
}

export { dateFromNow, dateToStr }
